/*
 * $Id$
 *
 * Copyright ( c ) 2014 XuNuo Corporation. All Rights Reserved.
 *
 * This software is the confidential and proprietary information of XuNuo
 * Corporation ("Confidential Information").  You shall not disclose such
 * Confidential Information and shall use it only in accordance with the terms
 * of the license agreement you entered into with XuNuo Corporation or a XuNuo
 * authorized reseller (the "License Agreement"). XuNuo may make changes to the
 * Confidential Information from time to time. Such Confidential Information may
 * contain errors.
 *
 * EXCEPT AS EXPLICITLY SET FORTH IN THE LICENSE AGREEMENT, XuNuo DISCLAIMS ALL
 * WARRANTIES, COVENANTS, REPRESENTATIONS, INDEMNITIES, AND GUARANTEES WITH
 * RESPECT TO SOFTWARE AND DOCUMENTATION, WHETHER EXPRESS OR IMPLIED, WRITTEN OR
 * ORAL, STATUTORY OR OTHERWISE INCLUDING, WITHOUT LIMITATION, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A
 * PARTICULAR PURPOSE. XuNuo DOES NOT WARRANT THAT END USER'S USE OF THE
 * SOFTWARE WILL BE UNINTERRUPTED, ERROR FREE OR SECURE.
 *
 * XuNuo SHALL NOT BE LIABLE TO END USER, OR ANY OTHER PERSON, CORPORATION OR
 * ENTITY FOR INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL
 * DAMAGES, OR DAMAGES FOR LOSS OF PROFITS, REVENUE, DATA OR USE, WHETHER IN AN
 * ACTION IN CONTRACT, TORT OR OTHERWISE, EVEN IF XuNuo HAS BEEN ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGES. XuNuo' TOTAL LIABILITY TO END USER SHALL NOT
 * EXCEED THE AMOUNTS PAID FOR THE XuNuo SOFTWARE BY END USER DURING THE PRIOR
 * TWELVE (12) MONTHS FROM THE DATE IN WHICH THE CLAIM AROSE.  BECAUSE SOME
 * STATES OR JURISDICTIONS DO NOT ALLOW LIMITATION OR EXCLUSION OF CONSEQUENTIAL
 * OR INCIDENTAL DAMAGES, THE ABOVE LIMITATION MAY NOT APPLY TO END USER.
 *
 * Copyright version 2.0
 */
package com.th.supcom.pds.recipefee.client.widget;

import java.util.ArrayList;
import java.util.List;

import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.th.supcom.pds.common.client.widget.PdsGrid;
import com.th.supcom.pds.drugsupply.client.model.DrugInfoModel;

/**
 * 收方收费主面板中的药品信息面板
 * 
 * @author 杨冲
 */
public class DrugPanel extends ContentPanel
{
    /** 提交路径. */
    public static final String SCC_BRANCH = "$URL$";

    /** 提交日期. */
    public static final String SCC_LAST_MODIFICATION_DATE = "$Date$";

    /** 最终修改人员. */
    public static final String SCC_LAST_MODIFIER_NAME = "$Author$";

    /** 最终版本号. */
    public static final String SCC_REVISION = "$Revision$";

    /**
     * 构造函数
     */
    public DrugPanel ()
    {
        initUI ();
    }

    private void createGrid ()
    {
        PdsGrid <DrugInfoModel> grid;
        grid = new PdsGrid <DrugInfoModel> ()
        {

            @Override
            public ColumnModel createColumnModel ()
            {
                return getColumnModel ();
            }
        };
        add (grid);
    }

    /**
     * 创建Grid列信息
     * 
     * @return
     */
    private ColumnModel getColumnModel ()
    {
        final List <ColumnConfig> configs = new ArrayList <ColumnConfig> ();
        ColumnConfig column = null;
        column = new ColumnConfig ("", "序号", 50);
        configs.add (column);
        column = new ColumnConfig ("", "药品编码", 80);
        configs.add (column);
        column = new ColumnConfig ("", "药品名称", 80);
        configs.add (column);
        column = new ColumnConfig ("", "药品规格", 80);
        configs.add (column);
        column = new ColumnConfig ("", "包装单位", 80);
        configs.add (column);
        column = new ColumnConfig ("", "数量", 80);
        configs.add (column);
        column = new ColumnConfig ("", "价格", 80);
        configs.add (column);
        column = new ColumnConfig ("", "金额", 80);
        configs.add (column);
        column = new ColumnConfig ("", "服法", 80);
        configs.add (column);
        column = new ColumnConfig ("", "备注", 80);
        configs.add (column);
        return new ColumnModel (configs);
    }

    /**
     * 初始化UI
     */
    private void initUI ()
    {
        this.setHeaderVisible (false);
        this.setLayout (new FitLayout ());

        createGrid ();
    }
}
